import axios from "../myaxios/myaxios";

//  写注释，说明接口是干什么用的。

//获取搜索列表
export const getSearchList = (params) =>
  axios.get("goods/search?page=1&limit=20&key=" + decodeURI(params));

//阿里妈妈总裁的API：
//图片地址拼接
// 在 baseURL文件夹下
//获取首页最顶部tab标签
export const getHomeTopTab = () => axios.get("category/list");
//获取热门推荐的内容
export const getHotRecommend = () => axios.get("goods/searchHot");

//获取新品推荐的内容
export const getNewRecommend = () => axios.get("goods/searchNew");
//获取首页手机标签中的数据内容
export const getMobileData = () => axios.get("goods/queryGoods?page=1&limit=50&idCategory=1");
//阿里妈妈API结束

// 获取首页下的topic页面的数据
export const getTopicData = (data) => axios.get("topic/" + data);



//获取验证码
export const getCode = (params) => axios.post("sendSmsCode?mobile=" + params);
//账密登录验证
export const getLogin = (mobile, smsCode) =>
  axios.post("loginOrReg?mobile=" + mobile + "&smsCode=" + smsCode);

//获取首页手机标签中的数据内容
export const getHomeData = (params) =>
  axios.get("goods/queryGoods", {
    params: params,
  });
//获取电视页面内容
export const getTelevisionData = () => axios.get("goods/queryGoods?page=1&limit=50&idCategory=2");
//阿里妈妈API结束

/* 商品详情页 */
//商品---点击喜欢发送请求
export const getGoodsLike = (params) => axios.post("user/favorite/add/" + params);
//商品---点击取消喜欢发送请求
export const getGoodsDislike = (params) => axios.post("user/favorite/dislike/" + params);
//商品---通过url获取商品详细数据
export const getGoodsDetailData = (params) => axios.get("goods/" + params);
//商品---判断商品是否已喜欢
export const getGoodsIfLike = (params) => axios.get("user/favorite/ifLike/" + params)
//商品---加入到购物车
export const getGoodsAdd = (num,id,sku) => axios.post("user/cart/add", {
  count: num, idGoods: id, idSku: sku
})
export const getGoodsCartNum = () => axios.get('user/cart/queryByUser')
/* 商品详情页结束 */
